<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<%
    Object err = request.getAttribute("ssoerror");
    String ssoerrExplicit = "";
    if (err != null && !"0".equals(err)) {
        if ("1".equals(err.toString())) {
            ssoerrExplicit = "用户名/密码错误";
        } else if ("2".equals(err.toString())) {
            ssoerrExplicit = "用户名/密码错误，您还有4次尝试登录机会";
        } else if ("3".equals(err.toString())) {
            ssoerrExplicit = "您的IP已被锁定";
        } else if ("4".equals(err.toString())) {
            ssoerrExplicit = "验证码错误";
        } else if ("5".equals(err.toString())) {
            ssoerrExplicit = "账户锁定";
        }
    }
    request.setAttribute("ssoerrExplicit", ssoerrExplicit);
%>
<head>
    <title>${fns:getConfig('productName')} 登录</title>
    <meta name="decorator" content="blank"/>
    <style type="text/css">
        html,body,table{width:100%;text-align:center;}.form-signin-heading{font-family:Helvetica, Georgia, Arial, sans-serif, 黑体;font-size:36px;margin-bottom:20px;color:#0663a2;}
        .form-signin{position:relative;text-align:left;width:300px;padding:25px 29px 29px;margin:0 auto 20px;background-color:#fff;border:1px solid #e5e5e5;
            -webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05);}
        .form-signin .checkbox{margin-bottom:10px;color:#0663a2;} .form-signin .input-label{font-size:16px;line-height:23px;color:#999;}
        .form-signin .input-block-level{font-size:16px;height:auto;margin-bottom:15px;padding:7px;*width:283px;*padding-bottom:0;_padding:7px 7px 9px 7px;}
        .form-signin .btn.btn-large{font-size:16px;} .form-signin #themeSwitch{position:absolute;right:15px;bottom:10px;}
        .form-signin div.validateCode {padding-bottom:15px;} .mid{vertical-align:middle;}
        .header{height:80px;padding-top:20px;} .alert{position:relative;width:300px;margin:0 auto;*padding-bottom:0px;}
        label.error{background:none;width:270px;font-weight:normal;color:inherit;margin:0;}
    </style>
    <script src="${ctxStatic}/common/backstretch.min.js"></script>
    <script type="text/javascript">
        var ssoerr = "${ssoerrExplicit}";

        function refresh_jcaptcha(obj) {
            obj.src = '${ssoDomain}/jcaptcha.do?captchaId='
                      + Math.random();
        }
        $(document).ready(function () {
            $.backstretch([
                "${ctxStatic}/images/bg1.jpg",
                "${ctxStatic}/images/bg2.jpg",
                "${ctxStatic}/images/bg3.jpg"
            ], {duration: 10000, fade: 2000});


            $("#loginForm").validate({
                                         errorLabelContainer: "#messageBox",
                                         errorPlacement: function (error, element) {
                                             error.appendTo($("#loginError").parent());
                                         }
                                     });
            $('#messageBox').bind('close', function () {
                $(this).css("display", "none");
                return false;
            });
        });
        // 如果在框架或在对话框中，则弹出提示并跳转到首页
        if (self.frameElement && self.frameElement.tagName == "IFRAME" || $('#left').length > 0 || $('.jbox').length
                                                                                                   > 0) {
            alert('未登录或登录超时。请重新登录，谢谢！');
            top.location = "${ctx}";
        }
    </script>
</head>
<body>
<!--[if lte IE 9]>
<br/>
<div class='alert alert-block' style="text-align:left;padding-bottom:10px;"><a class="close" data-dismiss="alert">x</a>
    <h4>温馨提示：</h4>
    <p>你使用的浏览器版本过低。为了获得更好的浏览体验，我们强烈建议您，直接使用本站提供的
        <a href="http://imgtest.wkey.cn/group1/M00/00/6F/yq0JB1XIN4qAbDnhAApgILD1Tlk747.exe" target="_blank">
            稳定版火狐</a>，您也可以使用较新版本的
        <a href="https://www.mozilla.org" target="_blank">Firefox</a>、Chrome、Safari 等，
        或者
        <a href="http://browsehappy.com" target="_blank">升级</a>
        到最新版本的IE浏览器。
        </p></div>
<![endif]-->
<div class="header">
    <div id="messageBox" class="alert alert-error ${empty ssoerrExplicit ? 'hide' : ''}">
        <button data-dismiss="alert" class="close">×</button>
        <label id="loginError" class="error">${ssoerrExplicit}</label>
    </div>
</div>
<h1 class="form-signin-heading">${fns:getConfig('productName')}</h1>

<form id="loginForm" class="form-signin" action="${appDomain}${adminPath}${ssoLoginUri}" method="post">
    <input type="hidden" name="service" id="service"
           value="${appDomain}${adminPath}${ssoLoginUri}"/>
    <input type="hidden" name="serviceToken" value="knet"/>
    <label class="input-label" for="username" data-rule-required="true" data-msg-required="请输入登录名">登录名</label>
    <input type="text" id="username" name="username" class="input-block-level required" value="${username}">
    <label class="input-label" for="password">密码</label>
    <input type="password" id="password" name="password" class="input-block-level required" data-rule-required="true" data-msg-required="请输入密码">

    <div class="validateCode">
        <!--input id="jcaptcha" name="jcaptcha" class="loginPublicInput " type="text" value=""
               style="width:78px;" placeholder="验证码" data-rule-required="true" data-msg-required="请输入验证码"/-->
       		<sys:validateCode name="jcaptcha" inputCssStyle="margin-bottom:0;"
					imageCssStyle="padding-top:1px;"/>
		<!-- a href="###" onclick="return false">
            <img onClick="refresh_jcaptcha(this)" id="jcaptchaImg" src="${ssoDomain}/jcaptcha.do"
                style="padding-bottom: 10px;width: 100px;height: 32px;">
        </a-->
    </div>
    <%--
         <label for="mobile" title="手机登录"><input type="checkbox" id="mobileLogin" name="mobileLogin" ${mobileLogin ? 'checked' : ''}/></label> --%>
    <input class="btn btn-large btn-primary" type="submit" value="登 录"/>&nbsp;&nbsp;
    <div id="themeSwitch" class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown"
           href="#">${fns:getDictLabel(cookie.theme.value,'theme','默认主题')}<b class="caret"></b></a>
        <ul class="dropdown-menu">
            <c:forEach items="${fns:getDictList('theme')}" var="dict">
                <li><a href="#"
                       onclick="location='${pageContext.request.contextPath}/theme/${dict.value}?url='+location.href">${dict.label}</a>
                </li>
            </c:forEach>
        </ul>
        <!--[if lte IE 6]>
        <script type="text/javascript">$('#themeSwitch').hide();</script><![endif]-->
    </div>
</form>
<div class="footer">
    Copyright &copy; 2012-${fns:getConfig('copyrightYear')} <a href="${pageContext.request.contextPath}${fns:getFrontPath()}">${fns:getConfig('productName')}</a> - Powered By <a href="#" target="_blank">BWKJ</a> ${fns:getConfig('version')}
    <br>
    <span>稳定版本firefox<a href="http://imgtest.wkey.cn/group1/M00/00/6F/yq0JB1XIN4qAbDnhAApgILD1Tlk747.exe" target="_blank" style="text-decoration: none">下载<fa class="fa fa-globe" style="line-height: 25px;font-size: 25px;"></fa></a></span>
    &nbsp;&nbsp;&nbsp;&nbsp;
    <span>电话条工具<a href="http://imgtest.wkey.cn/group1/M00/00/70/yq0JCFXJYKSAfJzPAIqsNOP-TAo656.zip" target="_blank" style="text-decoration: none">下载<fa class="fa fa-phone-sign" style="line-height: 25px;font-size: 25px;"></fa></a></span>
</div>
<script src="${ctxStatic}/flash/zoom.min.js" type="text/javascript"></script></body>
</html>